% This is the Reed College LaTeX thesis template. Most of the work
% for the document class was done by Sam Noble (SN), as well as this
% template. Later comments etc. by Ben Salzberg (BTS). Additional
% restructuring and APA support by Jess Youngberg (JY).
% Your comments and suggestions are more than welcome; please email
% them to cus@reed.edu
%
% See https://www.reed.edu/cis/help/LaTeX/index.html for help. There are a
% great bunch of help pages there, with notes on
% getting started, bibtex, etc. Go there and read it if you're not
% already familiar with LaTeX.
%
% Any line that starts with a percent symbol is a comment.
% They won't show up in the document, and are useful for notes
% to yourself and explaining commands.
% Commenting also removes a line from the document;
% very handy for troubleshooting problems. -BTS

% As far as I know, this follows the requirements laid out in
% the 2002-2003 Senior Handbook. Ask a librarian to check the
% document before binding. -SN

%%
%% Preamble
%%
% \documentclass{<something>} must begin each LaTeX document
\documentclass[12pt,twoside]{reedthesis}
% Packages are extensions to the basic LaTeX functions. Whatever you
% want to typeset, there is probably a package out there for it.
% Chemistry (chemtex), screenplays, you name it.
% Check out CTAN to see: https://www.ctan.org/
%%
\usepackage{graphicx,latexsym}
\usepackage{amsmath}
\usepackage{amssymb,amsthm}
\usepackage{longtable,booktabs,setspace}
\usepackage{chemarr} %% Useful for one reaction arrow, useless if you're not a chem major
\usepackage[hyphens]{url}
% Added by CII
\usepackage{hyperref}
\usepackage{lmodern}
\usepackage{float}
\floatplacement{figure}{H}
% Thanks, @Xyv
\usepackage{calc}
% End of CII addition
\usepackage{rotating}

% Next line commented out by CII
%%% \usepackage{natbib}
% Comment out the natbib line above and uncomment the following two lines to use the new
% biblatex-chicago style, for Chicago A. Also make some changes at the end where the
% bibliography is included.
%\usepackage{biblatex-chicago}
%\bibliography{thesis}


% Added by CII (Thanks, Hadley!)
% Use ref for internal links
\renewcommand{\hyperref}[2][???]{\autoref{#1}}
\def\chapterautorefname{Chapter}
\def\sectionautorefname{Section}
\def\subsectionautorefname{Subsection}
% End of CII addition

% Added by CII
\usepackage{caption}
\captionsetup{width=5in}
% End of CII addition

% \usepackage{times} % other fonts are available like times, bookman, charter, palatino

% Syntax highlighting #22
$if(highlighting-macros)$
  $highlighting-macros$
$endif$

% To pass between YAML and LaTeX the dollar signs are added by CII
\title{$title$}
\author{$author$}
% The month and year that you submit your FINAL draft TO THE LIBRARY (May or December)
\date{$date$}
\division{$division$}
\advisor{$advisor$}
\institution{$institution$}
\degree{$degree$}
%If you have two advisors for some reason, you can use the following
% Uncommented out by CII
$if(altadvisor)$
\altadvisor{$altadvisor$}
$endif$
% End of CII addition

%%% Remember to use the correct department!
\department{$department$}
% if you're writing a thesis in an interdisciplinary major,
% uncomment the line below and change the text as appropriate.
% check the Senior Handbook if unsure.
%\thedivisionof{The Established Interdisciplinary Committee for}
% if you want the approval page to say "Approved for the Committee",
% uncomment the next line
%\approvedforthe{Committee}

% Added by CII
%%% Copied from knitr
%% maxwidth is the original width if it's less than linewidth
%% otherwise use linewidth (to make sure the graphics do not exceed the margin)
\makeatletter
\def\maxwidth{ %
  \ifdim\Gin@nat@width>\linewidth
    \linewidth
  \else
    \Gin@nat@width
  \fi
}
\makeatother

% From {rticles}
$if(csl-refs)$
\newlength{\csllabelwidth}
\setlength{\csllabelwidth}{3em}
\newlength{\cslhangindent}
\setlength{\cslhangindent}{1.5em}
% for Pandoc 2.8 to 2.10.1
\newenvironment{cslreferences}%
  {$if(csl-hanging-indent)$\setlength{\parindent}{0pt}%
  \everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces$endif$}%
  {\par}
% For Pandoc 2.11+
% As noted by @mirh [2] is needed instead of [3] for 2.12
\newenvironment{CSLReferences}[2] % #1 hanging-ident, #2 entry spacing
 {% don't indent paragraphs
  \setlength{\parindent}{0pt}
  % turn on hanging indent if param 1 is 1
  \ifodd #1 \everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces\fi
  % set entry spacing
  \ifnum #2 > 0
  \setlength{\parskip}{#2\baselineskip}
  \fi
 }%
 {}
\usepackage{calc} % for calculating minipage widths
\newcommand{\CSLBlock}[1]{#1\hfill\break}
\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{#1}}
\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}}
\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
$endif$

\renewcommand{\contentsname}{Table of Contents}
% End of CII addition

\setlength{\parskip}{0pt}

% Added by CII
$if(space_between_paragraphs)$
  %\setlength{\parskip}{\baselineskip}
  \usepackage[parfill]{parskip}
$endif$

\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}

\Acknowledgements{
$acknowledgements$
}

\Dedication{
$dedication$
}

\Preface{
$preface$
}

\Abstract{
$abstract$
}

$for(header-includes)$
	$header-includes$
$endfor$
% End of CII addition
%%
%% End Preamble
%%
%

\begin{document}

% Everything below added by CII
$if(title)$
  \maketitle
$endif$

\frontmatter % this stuff will be roman-numbered
\pagestyle{empty} % this removes page numbers from the frontmatter

$if(acknowledgements)$
  \begin{acknowledgements}
    $acknowledgements$
  \end{acknowledgements}
$endif$

$if(preface)$
  \begin{preface}
    $preface$
  \end{preface}
$endif$

$if(abbreviations)$
\chapter*{List of Abbreviations}
\begin{longtable}{p{.20\textwidth} | p{.80\textwidth}}
  $for(abbreviations/pairs)$
    \textbf{$it.key$} & $it.value$ \\
  $endfor$
\end{longtable}
$endif$

$if(toc)$
  \hypersetup{linkcolor=$if(toccolor)$$toccolor$$else$black$endif$}
  \setcounter{secnumdepth}{$toc-depth$}
  \setcounter{tocdepth}{$toc-depth$}
  \tableofcontents
$endif$

$if(lot)$
  \listoftables
$endif$

$if(lof)$
  \listoffigures
$endif$

$if(abstract)$
  \begin{abstract}
    $abstract$
  \end{abstract}
$endif$

$if(dedication)$
  \begin{dedication}
    $dedication$
  \end{dedication}
$endif$

\mainmatter % here the regular arabic numbering starts
\pagestyle{fancyplain} % turns page numbering back on

$body$


% Index?

\end{document}
